package com.ant4j.popularize.ui;

import java.awt.GridLayout;
import java.io.IOException;

import javax.swing.JEditorPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

import com.ant4j.popularize.listenter.IHyperlinkListener;

/**
 * 
 * @description:官方公告面板
 * @author: <a href="mailto:hnxyhcwdl1003@163.com">wandalong</a>
 * @date: 2013-4-5
 */
public class MessagePanel extends JPanel {

	public MessagePanel() {
		this.setLayout(new GridLayout(1,2));
		
		JEditorPane editorPane = new JEditorPane();
		//放到滚动窗格中才能滚动查看所有内容  
		JScrollPane scrollPane = new JScrollPane(editorPane);  
		//设置是显示网页 html 文件,可选项  
		editorPane.setContentType("text/html");  
		//让我们的主体类实现了HyperlinkListener接口
		editorPane.addHyperlinkListener(new IHyperlinkListener());   
		//请把editorPane设置为只读，不然显示就不整齐  
		editorPane.setEditable(false); 
		try {
			
			String path = "http://www.baidu.com";  
			
			editorPane.setPage(path); 
		} catch (IOException e) {
			e.printStackTrace();
		}
		this.add(scrollPane);
	}

}
